import numpy as np
import csv

p = r'gps_20161101.csv'

with open(p) as f:
    data = np.loadtxt(f, str, delimiter = ",")

list = []
set = set()
extract = []

print('start run...')

for i in range(len(data) - 1, -1, -1):
    if (data[i][0], data[i][1]) in set:
        continue
    list.append(i)
    set.add((data[i][0], data[i][1]))

print(list)

for i in range(len(list) - 1, -1, -1):
    print(data[i])
    extract.append(data[list[i]])

for datum in extract:
    print(datum)

np.savetxt('extract2.csv',extract, fmt='%s', delimiter = ',', newline='\n')



print('end!')
